/**
  ******************************************************************************
  * File Name          : NetAtProcess.h
  * Description        : 本文档包含AT指令驱动网络模块的功能
  *
  ******************************************************************************
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __NET_AT_DEVICE__
#define __NET_AT_DEVICE__


/* Includes ------------------------------------------------------------------*/

#include "alldefine.h"
#include "SysTick.h"
#include <string.h>
#include "SysUart.h"
#include "Config.h"



/**
*如用户需要使用自己的网络模组，则在此自己添加网络模块的宏*
***/


/******网络模组型号宏定义 END*************/


//AT指令响应超时时间
#define			NET_AT_TIME_OUT				5000

#define AT_CMD_TEST1 "+++"
#define AT_CMD_TEST2 "a"
#define AT_CMD_TEST3 "AT\r\n"
#define AT_CMD_ATE "AT+E=OFF\r\n"

#define AT_CMD_ICCID "AT+ICCID\r\n"
#define AT_CMD_CCLK "AT+CCLK\r\n"

#define AT_CMD_APN "AT+APN=CMNET,,,0\r\n"
#define AT_CMD_SOCKA "AT+SOCKA=TCP,mqcpv2.devcld.com,3838\r\n"            //

#define AT_CMD_S "AT+S\r\n"

#define AT_CMD_ATOK "+ok"
#define AT_CMD_OK "OK"

#define ONLINEDATA "ICCID"
#define CSQDATA "CSQ"

#define OFFLINEDATA "OFFLINE"

typedef enum
{
	NET_STATE_INIT = 0,
	NET_STATE_TEST1,
	NET_STATE_TEST2,
	NET_STATE_TEST3,
	NET_STATE_ATE,
	NET_STATE_ICCID,
	NET_STATE_CCLK,
	NET_STATE_APN,
	NET_STATE_SOCKA,
	NET_STATE_S,
	NET_STATE_ONLINE

}NetSuccessState;

/*****************模块AT指令状态宏************************/
#define		RSP_AT_CMD_SEND		0
#define		RSP_AT_CMD_WAIT		1
#define		RSP_AT_CMD_OK			2
#define		RSP_AT_CMD_OUT		3
#define		RSP_AT_CMD_ERR		4
#define		RSP_AT_CMD_IDLE		5

#define		NET_SET_LINK_ONLINE				HAL_GPIO_WritePin(LED_LINK_GPIO_Port,LED_LINK_Pin,GPIO_PIN_RESET)
#define		NET_SET_LINK_OFFLINE			HAL_GPIO_WritePin(LED_LINK_GPIO_Port,LED_LINK_Pin,GPIO_PIN_SET)

#define	NET_AT_DELAY	350
#define	NET_MODEM_TIMEOUT		600
/************   DEFINE  end ********/

/* typedef struct ------------------------------------------------------------------*/

extern tUartRxBufDef *NetBuf;
extern uint16_t	LinkStart;
extern uint16_t AtSendTime;
/* Private function prototypes -----------------------------------------------*/

extern void	NetProcess(void);
extern void NetAtSend(uint8_t *AtBuf,uint16_t	AtBufLen);
extern void NetAtInit(void);
#endif /*__ pinoutConfig_H */

/**
  * @}
  */

/**
  * @}
  */

/************************ (C) COPYRIGHT INLEEQ *****END OF FILE****/
